function myNew(fn, ...args) {
    let obj = {}
    obj.__proto__ = fn.prototype
    let res = fn.apply(obj, args)
    return res instanceof Object ? res : obj
}

function Fn(name) {
    this.name = name
    return {
        a:1
    }
}
let obj = new Fn('张三')
console.log(obj);

let obj1 = myNew(Fn,'张三');
console.log(obj1)